Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 04 Dec 2010 17:56:59 -0800
From:      perryh@pluto.rain.com
To:        jgimer@gmail.com
Cc:        kline@thought.org, freebsd-questions@freebsd.org
Subject:   Re: regex question....
Message-ID:  <4cfaf16b./uHAeLS0wfpxq8FB%perryh@pluto.rain.com>
In-Reply-To: <AANLkTinXsSHj4kLha9SgR4T0Rn7TvH1cKmZ-pYe%2BgC-k@mail.gmail.com>
References:  <20101205002602.GA27499@thought.org> <AANLkTinXsSHj4kLha9SgR4T0Rn7TvH1cKmZ-pYe%2BgC-k@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Joshua Gimer <jgimer@gmail.com> wrote:

> On Sat, Dec 4, 2010 at 5:26 PM, Gary Kline <kline@thought.org> wrote:
> > I have tried :1,$/s/[0-9]][0-9][0-9]/foo/g
> Why not just %s/[0-9]*/foo/g

Too broad -- it will match the null string.  (* means "zero or more
instances of" whatever preceded it.)

Best RE I know for integers is

  [1-9][0-9]*

(or replace the 1 with a 0 if the strings in question might have
leading zeros).



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4cfaf16b./uHAeLS0wfpxq8FB%perryh>